<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="../../js/jquery-2.1.1.min.js"></script>
<style type="text/css">
	body{font-size:12px;text-align:center;}
	div,span{float:left;border:solid 1px #ccc;margin:8px;display:none;}
	.clsFraA{width:65px;height:65px;}
	.clsFraP{width:45px;height:45px;backgroung-color:#eee;}
	.clsFraC{width:25px;height:25px;backgroung-color:#ddd;}
</style>
<script type="text/javascript">
	$(function(){
		$("#divMid").css("display","block");
		//根据祖先元素匹配所有后代 元素
		$("div span").css("display","block");
	})
	$(function(){
		$("#divMid").css("display","block");
		//根据父元素匹配所有子元素
		$("div>span").css("display","block");
	})
	$(function(){
		//匹配所有紧跟在div后面的元素
		$("#divMid+div").css("display","block");
		//两个等价
		$("divMid").next().css("display","block");
	})
	$(function(){
		//匹配所有紧接在后面的元素
		$("#divMid~div").css("display","block");
		//等价
		$("divMid").nextAll().css("display","block");
	})
	$(function(){
		//匹配所有相邻 元素
		$("#divMid").siblings("div").css("display","block");
	})
</script>
</head>
<body>
	<div class="clsFraA">Left</div>
	<div class="clsFraA" id="divMid">
			<span class="clsFraP" id="Span1">
				<span class="clsFraC" id="Span2"></span>
			</span>
	</div>
	<div class="clsFraA">Right_1</div>
	<div class="clsFraA">Right_2</div>
</body>
</html>